package com.life.xxx.exception;

import com.life.xxx.util.ResultCode;

/**
 * 业务异常，用于主动抛出业务错误
 */
public class BusinessException extends RuntimeException {

    private final String code;

    public BusinessException(String code, String msg) {
        super(msg);
        this.code = code;
    }

    public BusinessException(ResultCode resultCode) {
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public String getCode() {
        return code;
    }
}